package com.dyit.service.impl;

import com.dyit.entity.Customer;
import com.dyit.mapper.ICustomerMapper;
import com.dyit.service.ICustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class CustomerServiceImpl implements ICustomerService {

    @Autowired
    private ICustomerMapper icm;
    @Override
    public void add(Customer customer) {
        icm.save(customer);
    }

    @Override
    public void deleteById(int id) {
        icm.delete(id);
    }

    @Override
    public void update(Customer customer) {

        System.out.println(customer);
        icm.update(customer);
    }

    @Override
    public List<Customer> findAll() {
        return icm.findAll();
    }

    @Override
    public Customer findCustomerByPhoneAndPassword(String phone, String password) {
        return icm.findCustomerByPhoneAndPassword(phone,password);
    }
}
